﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.ActiveRecord;
using ZDSoft.UPMS.Model.SystemPart;

namespace ZDSoft.UPMS.Model.BusinessPart
{
    /// <summary>
    /// 机构类
    /// </summary>
    /// Author：刘祖民
    /// CreateTime:2013-5-22

    [ActiveRecord]
    public class Organization : ModelBase<Organization>
    {
        /// <summary>
        /// 机构名称
        /// </summary>
        [Property]
        public string Name { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        [Property]
        public bool IsActive { get; set; }

        [HasMany(typeof(Organization), ColumnKey = "ParentID")]
        public IList<Organization> Organizations { get; set; }

        [BelongsTo("ParentID")]
        public Organization SubOrganization { get; set; }

        [HasMany(typeof(User), ColumnKey = "OrganizationID")]
        public IList<User> Users { get; set; }

        /// <summary>
        /// 负责人
        /// </summary>
        [BelongsTo("ChargeManID")]
        public User ChargeMan { get; set; }
        
        /// <summary>
        /// 教师教班级
        /// </summary>
        [HasMany(typeof(TeacherTeachingCourse), ColumnKey = "OrganizationID", Inverse = true)]
        public IList<TeacherTeachingCourse> TeacherTeachingCourses { get; set; }

    }
}
